<!DOCTYPE html>
<html lang="en" xmlns:th="http://www.thymeleaf.org"
      xmlns:shiro="http://www.pollix.org/thymeleaf/shiro">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
    <title>Title</title>
    <link rel="stylesheet" href="/resources/layui/css/layui.css">
</head>
<body>
<script src="/resources/layui/layui.js"></script>
<script type="text/javascript" src="/resources/js/jquery-1.12.3.min.js"></script>

<script th:inline="none">
    //一般直接写在一个js文件中
    layui.use(['layer', 'form','table'], function(){
        var layer = layui.layer
            ,form = layui.form
            ,table = layui.table
            ,$=layui.jquery;
        var id=$("#unitid").val();
        //根据父页面传来的id获取车辆信息并回填
        $.ajax({
            type:"get",
            url:"/unit/selectUnitById",
            data:{unitid:id},
            traditional:true,
            success:function(resp){
                console.log(resp.data.unit);
                var unit=resp.data.unit;
                $("#name").html(unit.name);
                $("#unittype").html(unit.unittype.name);
                $("#telephone").html(unit.telephone);
                $("#contact").html(unit.contact);
                $("#information").html(unit.information);
                $("#available").html(unit.available);
            }
        });
    });
</script>

<form class="layui-form" action="" id="formUpdate">
    <input type="hidden" id="unitid" name="id">
    <div class="layui-form-item">
        <label class="layui-form-label">单位名称：</label>
        <div class="layui-input-block">
            <span id="name" style="margin-top: 10px"></span>
        </div>
    </div>
    <div class="layui-form-item">
        <label class="layui-form-label">单位类型：</label>
        <div class="layui-input-block">
            <span id="unittype"></span>
        </div>
    </div>
    <div class="layui-form-item">
        <label class="layui-form-label">联系电话：</label>
        <div class="layui-input-block">
            <span id="telephone"></span>
        </div>
    </div>
    <div class="layui-form-item">
        <label class="layui-form-label">联系人：</label>
        <div class="layui-input-block">
            <span id="contact"></span>
        </div>
    </div>
    <div class="layui-form-item">
        <label class="layui-form-label">备注：</label>
        <div class="layui-input-block">
            <span id="information"></span>
        </div>
    </div>
    <div class="layui-form-item">
        <label class="layui-form-label">状态：</label>
        <div class="layui-input-block">
            <span id="available"></span>
        </div>
    </div>
</form>
</body>
</html>